package com.gisocn.onemap.ui.fragment;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import com.bumptech.glide.Glide;
import com.esri.android.map.MapView;
import com.esri.core.geometry.Envelope;
import com.esri.core.geometry.Geometry;
import com.esri.core.geometry.GeometryEngine;
import com.esri.core.geometry.Point;
import com.esri.core.geometry.SpatialReference;
import com.gisocn.onemap.base.BaseFragment;
import com.gisocn.onemap.base.CommonAdapter;
import com.gisocn.onemap.base.Constant;
import com.gisocn.onemap.base.MultiItemTypeAdapter;
import com.gisocn.onemap.base.ViewHolder;
import com.gisocn.onemap.event.MessageEvent;
import com.gisocn.onemap.interfaces.DownLoadListener;
import com.gisocn.onemap.interfaces.OnItemClickListener;
import com.gisocn.onemap.model.AppConfig;
import com.gisocn.onemap.model.Collection;
import com.gisocn.onemap.model.CollectionMapMarks;
import com.gisocn.onemap.model.DownLoadFileInfo;
import com.gisocn.onemap.model.GetDirectoryData;
import com.gisocn.onemap.model.PhotoInfo;
import com.gisocn.onemap.presenter.CollectionPresent;
import com.gisocn.onemap.sgzx.R;
import com.gisocn.onemap.ui.activity.FileBrowseActivity;
import com.gisocn.onemap.ui.activity.MainActivity;
import com.gisocn.onemap.ui.adapter.CollectionMapMarksAdapter;
import com.gisocn.onemap.ui.adapter.CollectionPhotoAdapter;
import com.gisocn.onemap.ui.adapter.CollectionProJectAdapter;
import com.gisocn.onemap.utils.L;
import com.gisocn.onemap.utils.SpUtils;
import com.gisocn.onemap.view.CollectionView;
import com.gisocn.onemap.widget.NumberProgressBar;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.tencent.smtt.sdk.TbsVideoCacheTask;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import kotlin.text.Typography;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

/* loaded from: classes.dex */
public class CollectionFragment extends BaseFragment<CollectionPresent> implements CollectionView {
    private AppConfig appConfig;
    private View collectionPopContentView;
    private PopupWindow collectionPopupWindow;
    private Dialog dialog;
    private String dirId;
    private String dirPath;
    private PopupWindow dirsPopupWindow;
    private View dirsView;
    CommonAdapter fileAdapter;
    private int fileIndex;
    @BindView(R.id.iv_add)
    ImageView ivAdd;
    @BindView(R.id.iv_menu)
    ImageView ivMenu;
    @BindView(R.id.ll_add)
    LinearLayout llAdd;
    private CollectionMapMarksAdapter mapMarksAdapter;
    private MapView mapView;
    private NumberProgressBar numberProgressBar;
    private CollectionPhotoAdapter photoAdapter;
    private CollectionProJectAdapter proJectAdapter;
    @BindView(R.id.recycle_build_fruit)
    RecyclerView recycleBuildFruit;
    @BindView(R.id.recycle_map_mark)
    RecyclerView recycleMapMark;
    @BindView(R.id.recycle_photo)
    RecyclerView recyclePhoto;
    @BindView(R.id.recycle_project)
    RecyclerView recycleProject;
    private CommonAdapter secondAdapter;
    private TextView tvFileName;
    private TextView tvIndex;
    private TextView tvOff;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    Unbinder unbinder;
    View view;
    int width;
    private ArrayList<Collection> collectionProjectList = new ArrayList<>();
    private ArrayList<CollectionMapMarks> collectionMapMarksList = new ArrayList<>();
    private ArrayList<PhotoInfo> photoInfosList = new ArrayList<>();
    private int index = 0;
    private ArrayList<GetDirectoryData.DataBean.DirsBean> dirList = new ArrayList<>();
    private ArrayList<GetDirectoryData.DataBean.FoldersBean> folderList = new ArrayList<>();
    private ArrayList<GetDirectoryData.DataBean.FilesBean> fileTextList = new ArrayList<>();
    private ArrayList<GetDirectoryData.DataBean.FilesBean> fileImageList = new ArrayList<>();
    private ArrayList<GetDirectoryData.DataBean.FilesBean> fileAttachmentList = new ArrayList<>();
    private final ArrayList<GetDirectoryData.DataBean.FilesBean> fileList = new ArrayList<>();
    private final ArrayList<GetDirectoryData.DataBean.FilesBean> popupFileList = new ArrayList<>();
    private ArrayList<DownLoadFileInfo> allDownLoadList = new ArrayList<>();
    private ArrayList<String> filesLocaList = new ArrayList<>();
    private int fileType = 0;
    int secondIndex = -1;
    Handler handler = new Handler() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.17
        @Override // android.os.Handler
        public void handleMessage(Message message) {
            super.handleMessage(message);
            int i = message.what;
            if (i == 1) {
                CollectionFragment.this.fileAdapter.notifyDataSetChanged();
            } else if (i == 2) {
                if (CollectionFragment.this.numberProgressBar != null) {
                    CollectionFragment.this.numberProgressBar.setProgress(message.arg1);
                    if (message.arg1 == 100 && message.arg2 == 1) {
                        CollectionFragment.this.dialog.dismiss();
                    }
                }
            } else if (i != 3) {
            } else {
                CollectionFragment.this.fileAdapter.notifyDataSetChanged();
                if (CollectionFragment.this.fileIndex >= CollectionFragment.this.allDownLoadList.size() - 1) {
                    CollectionFragment.this.dialog.dismiss();
                    return;
                }
                CollectionFragment.access$2208(CollectionFragment.this);
                CollectionFragment collectionFragment = CollectionFragment.this;
                collectionFragment.downLoadFile(((DownLoadFileInfo) collectionFragment.allDownLoadList.get(CollectionFragment.this.fileIndex)).getFileUrl(), ((DownLoadFileInfo) CollectionFragment.this.allDownLoadList.get(CollectionFragment.this.fileIndex)).getFileName(), ((DownLoadFileInfo) CollectionFragment.this.allDownLoadList.get(CollectionFragment.this.fileIndex)).getLocalPath(), true, CollectionFragment.this.fileIndex);
            }
        }
    };

    @Override // com.gisocn.onemap.view.CollectionView
    public void fail(String str) {
    }

    static /* synthetic */ int access$2208(CollectionFragment collectionFragment) {
        int i = collectionFragment.fileIndex;
        collectionFragment.fileIndex = i + 1;
        return i;
    }

    @Override // com.gisocn.onemap.base.BaseFragment, androidx.fragment.app.Fragment
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        View inflate = layoutInflater.inflate(R.layout.fragment_collection, viewGroup, false);
        this.view = inflate;
        this.unbinder = ButterKnife.bind(this, inflate);
        this.tvTitle.setText("专题数据");
        this.ivMenu.setVisibility(0);
        EventBus.getDefault().register(this);
        this.width = getResources().getDisplayMetrics().widthPixels;
        return this.view;
    }

    @Override // com.gisocn.onemap.base.BaseFragment
    protected void initData() {
        this.appConfig = ((MainActivity) getActivity()).getAppConfig();
        ArrayList arrayList = (ArrayList) new Gson().fromJson(SpUtils.get(getActivity(), "folderCollect", "").toString(), new TypeToken<List<GetDirectoryData.DataBean.FoldersBean>>() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.1
        }.getType());
        if (arrayList != null && arrayList.size() > 0) {
            this.folderList.clear();
            this.folderList.addAll(arrayList);
        }
        L.e("folderList" + this.folderList.size());
        this.ivAdd.setVisibility(getStr(this.tvTitle).equals("地图书签") ? 0 : 8);
        this.presenter = createPresenter();
        Gson gson = new Gson();
        ArrayList arrayList2 = (ArrayList) gson.fromJson(SpUtils.get(getActivity(), "collection", "") + "", new TypeToken<List<Collection>>() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.2
        }.getType());
        new Gson().toJson(arrayList2);
        Log.e("lists", "" + new Gson().toJson(arrayList2));
        if (arrayList2 != null) {
            this.collectionProjectList.clear();
            this.collectionProjectList.addAll(arrayList2);
        }
        Log.e("collectionProjectList", "" + this.collectionProjectList.size());
        Gson gson2 = new Gson();
        ArrayList arrayList3 = (ArrayList) gson2.fromJson(SpUtils.get(getActivity(), "mapMarks", "") + "", new TypeToken<List<CollectionMapMarks>>() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.3
        }.getType());
        if (arrayList3 != null) {
            this.collectionMapMarksList.clear();
            this.collectionMapMarksList.addAll(arrayList3);
        }
        ArrayList arrayList4 = (ArrayList) new Gson().fromJson(SpUtils.get(getActivity(), "photo_tag", "").toString(), new TypeToken<List<PhotoInfo>>() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.4
        }.getType());
        if (arrayList4 != null) {
            this.photoInfosList.clear();
            Iterator it = arrayList4.iterator();
            while (it.hasNext()) {
                PhotoInfo photoInfo = (PhotoInfo) it.next();
                if (photoInfo.isCollect()) {
                    this.photoInfosList.add(photoInfo);
                }
            }
        }
        initView();
    }

    @Override // com.gisocn.onemap.base.BaseFragment
    protected void onInvisible() {
        PopupWindow popupWindow = this.dirsPopupWindow;
        if (popupWindow != null) {
            popupWindow.dismiss();
        }
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // com.gisocn.onemap.base.BaseFragment
    public CollectionPresent createPresenter() {
        return new CollectionPresent(this);
    }

    void initView() {
        this.mapView = (MapView) getActivity().findViewById(R.id.map);
        this.proJectAdapter = new CollectionProJectAdapter(this.collectionProjectList);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
        linearLayoutManager.setOrientation(1);
        this.recycleProject.setLayoutManager(linearLayoutManager);
        this.recycleProject.setAdapter(this.proJectAdapter);
        this.proJectAdapter.setOnItemClickListener(new OnItemClickListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.5
            @Override // com.gisocn.onemap.interfaces.OnItemClickListener
            public void onItemClick(View view, int i, int i2) {
            }

            @Override // com.gisocn.onemap.interfaces.OnItemClickListener
            public void onItemClick(View view, int i) {
                Log.e("proJectAdapter", "onItemClick");
                CollectionFragment.this.index = i;
                Log.e("proJectAdapter", "" + ((Collection) CollectionFragment.this.collectionProjectList.get(i)).getDbName());
                ((CollectionPresent) CollectionFragment.this.presenter).getGeometry(((Collection) CollectionFragment.this.collectionProjectList.get(i)).getDbName(), ((Collection) CollectionFragment.this.collectionProjectList.get(i)).getId());
            }
        });
        this.mapMarksAdapter = new CollectionMapMarksAdapter(this.collectionMapMarksList);
        LinearLayoutManager linearLayoutManager2 = new LinearLayoutManager(getActivity());
        linearLayoutManager.setOrientation(1);
        this.recycleMapMark.setLayoutManager(linearLayoutManager2);
        this.recycleMapMark.setAdapter(this.mapMarksAdapter);
        this.mapMarksAdapter.setOnItemClickListener(new OnItemClickListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.6
            @Override // com.gisocn.onemap.interfaces.OnItemClickListener
            public void onItemClick(View view, int i, int i2) {
            }

            @Override // com.gisocn.onemap.interfaces.OnItemClickListener
            public void onItemClick(View view, int i) {
                CollectionFragment.this.mapView.setExtent(((CollectionMapMarks) CollectionFragment.this.collectionMapMarksList.get(i)).getEnvelope());
            }
        });
        this.photoAdapter = new CollectionPhotoAdapter(this.photoInfosList, getActivity());
        LinearLayoutManager linearLayoutManager3 = new LinearLayoutManager(getActivity());
        linearLayoutManager3.setOrientation(1);
        this.recyclePhoto.setLayoutManager(linearLayoutManager3);
        this.recyclePhoto.setAdapter(this.photoAdapter);
        this.photoAdapter.setOnItemClickListener(new OnItemClickListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.7
            @Override // com.gisocn.onemap.interfaces.OnItemClickListener
            public void onItemClick(View view, int i, int i2) {
            }

            @Override // com.gisocn.onemap.interfaces.OnItemClickListener
            public void onItemClick(View view, int i) {
                Point point = (Point) GeometryEngine.project(new Point(((PhotoInfo) CollectionFragment.this.photoInfosList.get(i)).getLongitude(), ((PhotoInfo) CollectionFragment.this.photoInfosList.get(i)).getLatitude()), SpatialReference.create(4326), CollectionFragment.this.mapView.getSpatialReference());
                CollectionFragment.this.mapView.setExtent(point);
                ((MainActivity) CollectionFragment.this.getActivity()).loadGeometry(point, ((PhotoInfo) CollectionFragment.this.photoInfosList.get(i)).getPhotoName(), ((PhotoInfo) CollectionFragment.this.photoInfosList.get(i)).getPhotoUrl());
            }
        });
        CommonAdapter<GetDirectoryData.DataBean.FoldersBean> commonAdapter = new CommonAdapter<GetDirectoryData.DataBean.FoldersBean>(getActivity(), R.layout.item_plan_database_second, this.folderList) { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.8
            /* JADX INFO: Access modifiers changed from: protected */
            @Override // com.gisocn.onemap.base.CommonAdapter
            public void convert(ViewHolder viewHolder, GetDirectoryData.DataBean.FoldersBean foldersBean, int i) {
                if (CollectionFragment.this.secondIndex == i) {
                    viewHolder.itemView.setBackgroundColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorGray));
                } else {
                    viewHolder.itemView.setBackgroundColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.white));
                }
                viewHolder.setText(R.id.tv_folders, ((GetDirectoryData.DataBean.FoldersBean) CollectionFragment.this.folderList.get(i)).getNAME());
                viewHolder.setVisible(R.id.iv_collect, false);
            }
        };
        this.secondAdapter = commonAdapter;
        commonAdapter.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.9
            @Override // com.gisocn.onemap.base.MultiItemTypeAdapter.OnItemClickListener
            public boolean onItemLongClick(View view, RecyclerView.ViewHolder viewHolder, int i) {
                return false;
            }

            @Override // com.gisocn.onemap.base.MultiItemTypeAdapter.OnItemClickListener
            public void onItemClick(View view, RecyclerView.ViewHolder viewHolder, int i) {
                CollectionFragment.this.secondIndex = i;
                CollectionFragment.this.secondAdapter.notifyDataSetChanged();
                CollectionFragment collectionFragment = CollectionFragment.this;
                collectionFragment.dirId = ((GetDirectoryData.DataBean.FoldersBean) collectionFragment.folderList.get(i)).getDIR_ID();
                Iterator it = CollectionFragment.this.dirList.iterator();
                while (it.hasNext()) {
                    GetDirectoryData.DataBean.DirsBean dirsBean = (GetDirectoryData.DataBean.DirsBean) it.next();
                    if (dirsBean.getDIR_ID().equals(CollectionFragment.this.dirId)) {
                        CollectionFragment.this.dirPath = dirsBean.getNAME();
                    }
                }
                CollectionFragment.this.fileTextList.clear();
                CollectionFragment.this.fileImageList.clear();
                CollectionFragment.this.fileAttachmentList.clear();
                Iterator it2 = CollectionFragment.this.fileList.iterator();
                while (it2.hasNext()) {
                    GetDirectoryData.DataBean.FilesBean filesBean = (GetDirectoryData.DataBean.FilesBean) it2.next();
                    if (((GetDirectoryData.DataBean.FoldersBean) CollectionFragment.this.folderList.get(i)).getCNUM().equals(filesBean.getCNUM())) {
                        if (filesBean.getFILETYPE().equals("文本")) {
                            CollectionFragment.this.fileTextList.add(filesBean);
                        } else if (filesBean.getFILETYPE().equals("图件")) {
                            CollectionFragment.this.fileImageList.add(filesBean);
                        }
                    }
                }
                CollectionFragment collectionFragment2 = CollectionFragment.this;
                collectionFragment2.getDirsDataPopupWindow(collectionFragment2.fileTextList, CollectionFragment.this.fileImageList, CollectionFragment.this.fileAttachmentList, i, CollectionFragment.this.getActivity().findViewById(R.id.viewPager));
            }
        });
        this.recycleBuildFruit.setLayoutManager(new LinearLayoutManager(getActivity()));
        this.recycleBuildFruit.setAdapter(this.secondAdapter);
    }

    @Override // com.gisocn.onemap.base.BaseFragment, androidx.fragment.app.Fragment
    public void onDestroyView() {
        super.onDestroyView();
        this.unbinder.unbind();
    }

    @OnClick({R.id.tv_close, R.id.iv_menu, R.id.iv_add})
    public void onViewClicked(View view) {
        int id = view.getId();
        if (id != R.id.iv_add) {
            if (id == R.id.iv_menu) {
                collectionPopWindow(this.ivMenu);
                return;
            } else if (id != R.id.tv_close) {
                return;
            } else {
                getActivity().findViewById(R.id.viewPager).setVisibility(8);
                return;
            }
        }
        Log.e("iv_add", "OnClick");
        Point center = this.mapView.getCenter();
        double width = this.mapView.getWidth();
        double resolution = this.mapView.getResolution();
        Double.isNaN(width);
        double d = width * resolution;
        double width2 = this.mapView.getWidth();
        double resolution2 = this.mapView.getResolution();
        Double.isNaN(width2);
        Envelope envelope = new Envelope(center, d, width2 * resolution2);
        String format = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date());
        CollectionMapMarks collectionMapMarks = new CollectionMapMarks();
        collectionMapMarks.setDate(format);
        collectionMapMarks.setEnvelope(envelope);
        this.collectionMapMarksList.add(collectionMapMarks);
        SpUtils.put(getActivity(), "mapMarks", new Gson().toJson(this.collectionMapMarksList));
        this.mapMarksAdapter.notifyDataSetChanged();
        Log.e("iv_add", "OnClick" + this.collectionMapMarksList.size());
    }

    public void updataProJect() {
        Gson gson = new Gson();
        ArrayList arrayList = (ArrayList) gson.fromJson(SpUtils.get(getActivity(), "collection", "") + "", new TypeToken<List<Collection>>() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.10
        }.getType());
        new Gson().toJson(arrayList);
        Log.e("lists", "" + new Gson().toJson(arrayList));
        if (arrayList != null) {
            this.collectionProjectList.clear();
            this.collectionProjectList.addAll(arrayList);
        }
        this.proJectAdapter.notifyDataSetChanged();
    }

    public void updataPhoto() {
        ArrayList arrayList = (ArrayList) new Gson().fromJson(SpUtils.get(getActivity(), "photo_tag", "").toString(), new TypeToken<List<PhotoInfo>>() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.11
        }.getType());
        if (arrayList != null) {
            this.photoInfosList.clear();
            this.photoInfosList.addAll(arrayList);
        }
        this.photoAdapter.notifyDataSetChanged();
    }

    public void updataBuildFruit() {
        ArrayList arrayList = (ArrayList) new Gson().fromJson(SpUtils.get(getActivity(), "folderCollect", "").toString(), new TypeToken<List<GetDirectoryData.DataBean.FoldersBean>>() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.12
        }.getType());
        if (arrayList.size() > 0) {
            this.folderList.clear();
            this.folderList.addAll(arrayList);
        }
        CommonAdapter commonAdapter = this.secondAdapter;
        if (commonAdapter != null) {
            commonAdapter.notifyDataSetChanged();
        }
        HashMap hashMap = new HashMap();
        hashMap.put("UserId", SpUtils.get(getActivity(), "userId", "") + "");
        hashMap.put("DeviceKey", SpUtils.get(getActivity(), "deviceId", "") + "");
        ((CollectionPresent) this.presenter).getDirectoryData(hashMap);
    }

    private void collectionPopWindow(View view) {
        if (this.collectionPopContentView == null) {
            this.collectionPopContentView = View.inflate(getActivity(), R.layout.popup_collection, null);
        }
        if (this.collectionPopupWindow == null) {
            this.collectionPopupWindow = new PopupWindow(this.collectionPopContentView, this.view.getWidth(), -2, true);
        }
        RelativeLayout relativeLayout = (RelativeLayout) this.collectionPopContentView.findViewById(R.id.rl_build_fruit);
        relativeLayout.setVisibility(8);
        ((RelativeLayout) this.collectionPopContentView.findViewById(R.id.rl_project_data)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.13
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                CollectionFragment.this.recycleProject.setVisibility(0);
                CollectionFragment.this.recycleBuildFruit.setVisibility(8);
                CollectionFragment.this.recycleMapMark.setVisibility(8);
                CollectionFragment.this.recyclePhoto.setVisibility(8);
                CollectionFragment.this.tvTitle.setText("专题数据");
                ImageView imageView = CollectionFragment.this.ivAdd;
                CollectionFragment collectionFragment = CollectionFragment.this;
                imageView.setVisibility(collectionFragment.getStr(collectionFragment.tvTitle).equals("地图书签") ? 0 : 8);
                CollectionFragment.this.collectionPopupWindow.dismiss();
                Gson gson = new Gson();
                ArrayList arrayList = (ArrayList) gson.fromJson(SpUtils.get(CollectionFragment.this.getActivity(), "collection", "") + "", new TypeToken<List<Collection>>() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.13.1
                }.getType());
                new Gson().toJson(arrayList);
                Log.e("lists", "" + new Gson().toJson(arrayList));
                if (arrayList != null) {
                    CollectionFragment.this.collectionProjectList.clear();
                    CollectionFragment.this.collectionProjectList.addAll(arrayList);
                    CollectionFragment.this.proJectAdapter.notifyDataSetChanged();
                }
            }
        });
        relativeLayout.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.14
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                CollectionFragment.this.tvTitle.setText("规建成果");
                ImageView imageView = CollectionFragment.this.ivAdd;
                CollectionFragment collectionFragment = CollectionFragment.this;
                imageView.setVisibility(collectionFragment.getStr(collectionFragment.tvTitle).equals("地图书签") ? 0 : 8);
                CollectionFragment.this.collectionPopupWindow.dismiss();
                CollectionFragment.this.recycleProject.setVisibility(8);
                CollectionFragment.this.recycleBuildFruit.setVisibility(0);
                CollectionFragment.this.recycleMapMark.setVisibility(8);
                CollectionFragment.this.recyclePhoto.setVisibility(8);
                HashMap hashMap = new HashMap();
                hashMap.put("UserId", SpUtils.get(CollectionFragment.this.getActivity(), "userId", "") + "");
                hashMap.put("DeviceKey", SpUtils.get(CollectionFragment.this.getActivity(), "deviceId", "") + "");
                ((CollectionPresent) CollectionFragment.this.presenter).getDirectoryData(hashMap);
            }
        });
        ((RelativeLayout) this.collectionPopContentView.findViewById(R.id.rl_map_marks)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.15
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                CollectionFragment.this.tvTitle.setText("地图书签");
                ImageView imageView = CollectionFragment.this.ivAdd;
                CollectionFragment collectionFragment = CollectionFragment.this;
                imageView.setVisibility(collectionFragment.getStr(collectionFragment.tvTitle).equals("地图书签") ? 0 : 8);
                CollectionFragment.this.collectionPopupWindow.dismiss();
                CollectionFragment.this.recycleProject.setVisibility(8);
                CollectionFragment.this.recycleBuildFruit.setVisibility(8);
                CollectionFragment.this.recycleMapMark.setVisibility(0);
                CollectionFragment.this.recyclePhoto.setVisibility(8);
                Gson gson = new Gson();
                ArrayList arrayList = (ArrayList) gson.fromJson(SpUtils.get(CollectionFragment.this.getActivity(), "mapMarks", "") + "", new TypeToken<List<CollectionMapMarks>>() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.15.1
                }.getType());
                if (arrayList != null) {
                    CollectionFragment.this.collectionMapMarksList.clear();
                    CollectionFragment.this.collectionMapMarksList.addAll(arrayList);
                }
                CollectionFragment.this.mapMarksAdapter.notifyDataSetChanged();
            }
        });
        ((RelativeLayout) this.collectionPopContentView.findViewById(R.id.rl_photo)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.16
            @Override // android.view.View.OnClickListener
            public void onClick(View view2) {
                CollectionFragment.this.tvTitle.setText("照片");
                ImageView imageView = CollectionFragment.this.ivAdd;
                CollectionFragment collectionFragment = CollectionFragment.this;
                imageView.setVisibility(collectionFragment.getStr(collectionFragment.tvTitle).equals("地图书签") ? 0 : 8);
                CollectionFragment.this.collectionPopupWindow.dismiss();
                CollectionFragment.this.recycleProject.setVisibility(8);
                CollectionFragment.this.recycleBuildFruit.setVisibility(8);
                CollectionFragment.this.recycleMapMark.setVisibility(8);
                CollectionFragment.this.recyclePhoto.setVisibility(0);
                ArrayList arrayList = (ArrayList) new Gson().fromJson(SpUtils.get(CollectionFragment.this.getActivity(), "photo_tag", "").toString(), new TypeToken<List<PhotoInfo>>() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.16.1
                }.getType());
                if (arrayList != null) {
                    CollectionFragment.this.photoInfosList.clear();
                    Iterator it = arrayList.iterator();
                    while (it.hasNext()) {
                        PhotoInfo photoInfo = (PhotoInfo) it.next();
                        if (photoInfo.isCollect()) {
                            CollectionFragment.this.photoInfosList.add(photoInfo);
                        }
                    }
                }
                CollectionFragment.this.photoAdapter.notifyDataSetChanged();
            }
        });
        this.collectionPopupWindow.setOutsideTouchable(true);
        this.collectionPopupWindow.setBackgroundDrawable(new BitmapDrawable());
        PopupWindow popupWindow = this.collectionPopupWindow;
        popupWindow.showAsDropDown(view, -((popupWindow.getWidth() / 2) - ((view.getWidth() + ((int) ((getActivity().getResources().getDisplayMetrics().density * 10.0f) + 0.5f))) / 2)), 30);
    }

    @Override // com.gisocn.onemap.view.CollectionView
    public void getGeometry(Geometry geometry) {
        ((MainActivity) getActivity()).detailLandInfoPopWindow(this.collectionProjectList.get(this.index).getLandInfos(), geometry, this.collectionProjectList.get(this.index).getLayerName(), this.collectionProjectList.get(this.index).getDisplayField(), this.collectionProjectList.get(this.index).getDbName(), String.valueOf(this.collectionProjectList.get(this.index).getId()));
        this.mapView.setExtent(geometry);
        ((MainActivity) getActivity()).loadGeometry(geometry, this.collectionProjectList.get(this.index).getLayerName() + this.collectionProjectList.get(this.index).getDisplayField());
    }

    @Override // com.gisocn.onemap.view.CollectionView
    public void getDownLoadSuccess(String str) {
        this.filesLocaList.add(str);
        this.handler.sendEmptyMessage(1);
    }

    @Override // com.gisocn.onemap.view.CollectionView
    public void getDownLoadSuccess(String str, int i) {
        this.fileIndex = i;
        this.filesLocaList.add(str);
        Message message = new Message();
        message.what = 3;
        message.arg1 = i;
        this.handler.sendMessage(message);
    }

    @Override // com.gisocn.onemap.view.CollectionView
    public void getDirectoryDataSuccess(GetDirectoryData getDirectoryData) {
        this.fileList.clear();
        this.dirList = (ArrayList) getDirectoryData.getData().getDirs();
        Iterator<GetDirectoryData.DataBean.FoldersBean> it = this.folderList.iterator();
        while (it.hasNext()) {
            GetDirectoryData.DataBean.FoldersBean next = it.next();
            for (GetDirectoryData.DataBean.FilesBean filesBean : getDirectoryData.getData().getFiles()) {
                if (next.getCNUM().equals(filesBean.getCNUM())) {
                    this.fileList.add(filesBean);
                }
            }
        }
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onMessageEvent(MessageEvent messageEvent) {
        String str = messageEvent.eventType;
        str.hashCode();
        char c = 65535;
        switch (str.hashCode()) {
            case -1065100452:
                if (str.equals(Constant.MESSAGE_EVENT_UPDATA_COLLECTION_BUILD_FRUIT)) {
                    c = 0;
                    break;
                }
                break;
            case 389614955:
                if (str.equals(Constant.MESSAGE_EVENT_UPDATA_COLLECTION_PHOTO)) {
                    c = 1;
                    break;
                }
                break;
            case 1043803154:
                if (str.equals(Constant.MESSAGE_EVENT_UPDATA_COLLECTION_PROJECT)) {
                    c = 2;
                    break;
                }
                break;
        }
        switch (c) {
            case 0:
                updataBuildFruit();
                return;
            case 1:
                L.e("FRAGMENT_MESSAGE_EVENT_UPDATA_COLLECTION");
                updataPhoto();
                return;
            case 2:
                L.e("FRAGMENT_MESSAGE_EVENT_UPDATA_COLLECTION");
                updataProJect();
                return;
            default:
                return;
        }
    }

    void getDirsDataPopupWindow(final ArrayList<GetDirectoryData.DataBean.FilesBean> arrayList, final ArrayList<GetDirectoryData.DataBean.FilesBean> arrayList2, final ArrayList<GetDirectoryData.DataBean.FilesBean> arrayList3, int i, View view) {
        int i2;
        this.popupFileList.clear();
        getLocalFiles(Constant.PLAN_DATA_BASE_PATH);
        int i3 = this.fileType;
        if (i3 == 0) {
            this.popupFileList.addAll(arrayList);
        } else if (i3 == 1) {
            this.popupFileList.addAll(arrayList2);
        }
        if (this.dirsView == null) {
            View inflate = View.inflate(getActivity(), R.layout.popup_dirs, null);
            this.dirsView = inflate;
            inflate.measure(0, 0);
            i2 = (this.width - view.getWidth()) - getActivity().findViewById(R.id.leftTools_layout).getWidth();
        } else {
            i2 = 0;
        }
        if (this.dirsPopupWindow == null && this.dirsView != null) {
            int dimensionPixelOffset = getResources().getDimensionPixelOffset(R.dimen.dp_165);
            this.dirsPopupWindow = new PopupWindow(this.dirsView, i2, -1);
            TextView textView = (TextView) this.dirsView.findViewById(R.id.tv_download_all);
            final TextView textView2 = (TextView) this.dirsView.findViewById(R.id.tv_plan_text);
            final TextView textView3 = (TextView) this.dirsView.findViewById(R.id.tv_plan_image);
            final TextView textView4 = (TextView) this.dirsView.findViewById(R.id.tv_plan_attachment);
            RecyclerView recyclerView = (RecyclerView) this.dirsView.findViewById(R.id.recycle_file);
            L.e("dirsView.getWidth()" + i2);
            L.e("itemWidth" + dimensionPixelOffset);
            recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), (int) Math.floor((double) (i2 / dimensionPixelOffset))));
            CommonAdapter<GetDirectoryData.DataBean.FilesBean> commonAdapter = new CommonAdapter<GetDirectoryData.DataBean.FilesBean>(getActivity(), R.layout.item_file_package, this.popupFileList) { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.18
                /* JADX INFO: Access modifiers changed from: protected */
                @Override // com.gisocn.onemap.base.CommonAdapter
                public void convert(ViewHolder viewHolder, GetDirectoryData.DataBean.FilesBean filesBean, int i4) {
                    viewHolder.getView(R.id.tv_file_name).setVisibility(0);
                    viewHolder.setText(R.id.tv_file_name, ((GetDirectoryData.DataBean.FilesBean) CollectionFragment.this.popupFileList.get(i4)).getFILENAME());
                    viewHolder.setText(R.id.tv_file_name_szie, ((GetDirectoryData.DataBean.FilesBean) CollectionFragment.this.popupFileList.get(i4)).getFILESIZE() + "KB");
                    String str = CollectionFragment.this.dirPath + "/" + ((GetDirectoryData.DataBean.FoldersBean) CollectionFragment.this.folderList.get(CollectionFragment.this.secondIndex)).getNAME() + "/" + ((GetDirectoryData.DataBean.FilesBean) CollectionFragment.this.popupFileList.get(i4)).getFILETYPE() + "/";
                    if (CollectionFragment.this.isLocalExist(Constant.PLAN_DATA_BASE_PATH + str + ((GetDirectoryData.DataBean.FilesBean) CollectionFragment.this.popupFileList.get(i4)).getFILENAME())) {
                        viewHolder.setVisible(R.id.iv_download, false);
                        if (CollectionFragment.this.fileType != 0) {
                            if (CollectionFragment.this.fileType == 1) {
                                viewHolder.setVisible(R.id.iv_download_bg, true);
                                Glide.with(CollectionFragment.this.getActivity()).load(Constant.PLAN_DATA_BASE_PATH + str + ((GetDirectoryData.DataBean.FilesBean) CollectionFragment.this.popupFileList.get(i4)).getFILENAME()).thumbnail(0.1f).into((ImageView) viewHolder.getView(R.id.iv_download_bg));
                                return;
                            }
                            return;
                        }
                        viewHolder.setVisible(R.id.iv_download_bg, false);
                        if (!((GetDirectoryData.DataBean.FilesBean) CollectionFragment.this.popupFileList.get(i4)).getEXTNAME().contains("pdf")) {
                            if (!((GetDirectoryData.DataBean.FilesBean) CollectionFragment.this.popupFileList.get(i4)).getEXTNAME().contains("doc")) {
                                if (((GetDirectoryData.DataBean.FilesBean) CollectionFragment.this.popupFileList.get(i4)).getEXTNAME().contains("xls")) {
                                    viewHolder.setBackgroundRes(R.id.rl_download, R.mipmap.icon_excel);
                                    return;
                                }
                                return;
                            }
                            viewHolder.setBackgroundRes(R.id.rl_download, R.mipmap.icon_docx);
                            return;
                        }
                        viewHolder.setBackgroundRes(R.id.rl_download, R.mipmap.icon_pdf);
                        return;
                    }
                    viewHolder.setVisible(R.id.iv_download, true);
                    viewHolder.setVisible(R.id.iv_download_bg, true);
                    viewHolder.setImageResource(R.id.iv_download_bg, R.mipmap.icon_download_bg);
                    viewHolder.setImageResource(R.id.iv_download, R.mipmap.icon_download);
                    viewHolder.setBackgroundRes(R.id.rl_download, R.color.white);
                }
            };
            this.fileAdapter = commonAdapter;
            recyclerView.setAdapter(commonAdapter);
            this.fileAdapter.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.19
                @Override // com.gisocn.onemap.base.MultiItemTypeAdapter.OnItemClickListener
                public boolean onItemLongClick(View view2, RecyclerView.ViewHolder viewHolder, int i4) {
                    return false;
                }

                @Override // com.gisocn.onemap.base.MultiItemTypeAdapter.OnItemClickListener
                public void onItemClick(View view2, RecyclerView.ViewHolder viewHolder, int i4) {
                    String filename = ((GetDirectoryData.DataBean.FilesBean) CollectionFragment.this.popupFileList.get(i4)).getFILENAME();
                    String str = CollectionFragment.this.dirPath + "/" + ((GetDirectoryData.DataBean.FoldersBean) CollectionFragment.this.folderList.get(CollectionFragment.this.secondIndex)).getNAME() + "/" + ((GetDirectoryData.DataBean.FilesBean) CollectionFragment.this.popupFileList.get(i4)).getFILETYPE() + "/";
                    if (CollectionFragment.this.isLocalExist(Constant.PLAN_DATA_BASE_PATH + str + filename)) {
                        Intent intent = new Intent(CollectionFragment.this.getActivity(), FileBrowseActivity.class);
                        intent.putExtra(TbsVideoCacheTask.KEY_VIDEO_CACHE_PARAM_URL, "local");
                        intent.putExtra("fileUrl", Constant.PLAN_DATA_BASE_PATH + str + filename);
                        intent.putExtra("fileName", filename);
                        CollectionFragment.this.startActivity(intent);
                        return;
                    }
                    CollectionFragment.this.downLoadFile(CollectionFragment.this.appConfig.getGhcgServiceURL().getGHCGFileURL() + CollectionFragment.this.dirId + "/" + ((GetDirectoryData.DataBean.FilesBean) CollectionFragment.this.popupFileList.get(i4)).getCNUM() + "/" + ((GetDirectoryData.DataBean.FilesBean) CollectionFragment.this.popupFileList.get(i4)).getFILETYPE() + "/" + ((GetDirectoryData.DataBean.FilesBean) CollectionFragment.this.popupFileList.get(i4)).getFILENAME(), filename, str, false, 0);
                }
            });
            ((TextView) this.dirsView.findViewById(R.id.tv_close)).setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.20
                @Override // android.view.View.OnClickListener
                public void onClick(View view2) {
                    CollectionFragment.this.dirsPopupWindow.dismiss();
                }
            });
            textView2.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.21
                @Override // android.view.View.OnClickListener
                public void onClick(View view2) {
                    CollectionFragment.this.fileType = 0;
                    textView2.setTextColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorWhite));
                    textView2.setBackgroundColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorPrimary));
                    textView3.setTextColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorPrimary));
                    textView3.setBackgroundColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorWhite));
                    textView4.setTextColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorPrimary));
                    textView4.setBackgroundColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorWhite));
                    CollectionFragment.this.popupFileList.clear();
                    CollectionFragment.this.popupFileList.addAll(arrayList);
                    CollectionFragment.this.fileAdapter.notifyDataSetChanged();
                }
            });
            textView3.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.22
                @Override // android.view.View.OnClickListener
                public void onClick(View view2) {
                    CollectionFragment.this.fileType = 1;
                    textView2.setTextColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorPrimary));
                    textView2.setBackgroundColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorWhite));
                    textView3.setTextColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorWhite));
                    textView3.setBackgroundColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorPrimary));
                    textView4.setTextColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorPrimary));
                    textView4.setBackgroundColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorWhite));
                    CollectionFragment.this.popupFileList.clear();
                    CollectionFragment.this.popupFileList.addAll(arrayList2);
                    CollectionFragment.this.fileAdapter.notifyDataSetChanged();
                }
            });
            textView4.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.23
                @Override // android.view.View.OnClickListener
                public void onClick(View view2) {
                    CollectionFragment.this.fileType = 3;
                    textView2.setTextColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorPrimary));
                    textView2.setBackgroundColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorWhite));
                    textView3.setTextColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorPrimary));
                    textView3.setBackgroundColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorWhite));
                    textView4.setTextColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorWhite));
                    textView4.setBackgroundColor(ContextCompat.getColor(CollectionFragment.this.getActivity(), R.color.colorPrimary));
                    CollectionFragment.this.popupFileList.clear();
                    CollectionFragment.this.popupFileList.addAll(arrayList3);
                    CollectionFragment.this.fileAdapter.notifyDataSetChanged();
                }
            });
            textView.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.24
                @Override // android.view.View.OnClickListener
                public void onClick(View view2) {
                    CollectionFragment.this.allDownLoadList.clear();
                    ArrayList arrayList4 = new ArrayList();
                    arrayList4.addAll(arrayList);
                    arrayList4.addAll(arrayList2);
                    Iterator it = arrayList4.iterator();
                    while (it.hasNext()) {
                        GetDirectoryData.DataBean.FilesBean filesBean = (GetDirectoryData.DataBean.FilesBean) it.next();
                        DownLoadFileInfo downLoadFileInfo = new DownLoadFileInfo();
                        String str = CollectionFragment.this.appConfig.getGhcgServiceURL().getGHCGFileURL() + CollectionFragment.this.dirId + "/" + filesBean.getCNUM() + "/" + filesBean.getFILETYPE() + "/" + filesBean.getFILENAME();
                        String str2 = CollectionFragment.this.dirPath + "/" + ((GetDirectoryData.DataBean.FoldersBean) CollectionFragment.this.folderList.get(CollectionFragment.this.secondIndex)).getNAME() + "/" + filesBean.getFILETYPE() + "/";
                        if (!CollectionFragment.this.isLocalExist(Constant.PLAN_DATA_BASE_PATH + str2 + filesBean.getFILENAME()) && (filesBean.getFILETYPE().equals("图件") || filesBean.getFILETYPE().equals("文本"))) {
                            downLoadFileInfo.setFileName(filesBean.getFILENAME());
                            downLoadFileInfo.setFileUrl(str);
                            downLoadFileInfo.setLocalPath(str2);
                            L.e("setFileName" + filesBean.getFILENAME());
                            CollectionFragment.this.allDownLoadList.add(downLoadFileInfo);
                        }
                    }
                    if (CollectionFragment.this.allDownLoadList.size() > 0) {
                        CollectionFragment.this.fileIndex = 0;
                        CollectionFragment collectionFragment = CollectionFragment.this;
                        collectionFragment.downLoadFile(((DownLoadFileInfo) collectionFragment.allDownLoadList.get(0)).getFileUrl(), ((DownLoadFileInfo) CollectionFragment.this.allDownLoadList.get(0)).getFileName(), ((DownLoadFileInfo) CollectionFragment.this.allDownLoadList.get(0)).getLocalPath(), true, CollectionFragment.this.fileIndex);
                    }
                }
            });
        }
        this.fileAdapter.notifyDataSetChanged();
        this.dirsPopupWindow.setOutsideTouchable(false);
        this.dirsPopupWindow.setFocusable(false);
        this.dirsPopupWindow.setBackgroundDrawable(new BitmapDrawable());
        this.dirsPopupWindow.showAsDropDown(view, view.getWidth(), 0);
    }

    public void getLocalFiles(String str) {
        Log.e("path", str);
        File[] listFiles = new File(str).listFiles();
        if (listFiles == null) {
            Log.e("error", "空目录");
            return;
        }
        for (int i = 0; i < listFiles.length; i++) {
            if (listFiles[i].isDirectory()) {
                getLocalFiles(listFiles[i].getAbsolutePath());
            } else {
                this.filesLocaList.add(listFiles[i].getAbsolutePath());
            }
        }
    }

    void downLoadFile(String str, String str2, String str3, final boolean z, int i) {
        if (isLocalExist(Constant.PLAN_DATA_BASE_PATH + str3 + str2)) {
            Intent intent = new Intent(getActivity(), FileBrowseActivity.class);
            intent.putExtra(TbsVideoCacheTask.KEY_VIDEO_CACHE_PARAM_URL, "local");
            intent.putExtra("fileUrl", Constant.PLAN_DATA_BASE_PATH + str3 + str2);
            intent.putExtra("fileName", str2);
            startActivity(intent);
            return;
        }
        Dialog dialog = this.dialog;
        if (dialog != null) {
            dialog.show();
            TextView textView = this.tvFileName;
            textView.setText("正在下载\"" + str2 + Typography.quote);
            if (z) {
                TextView textView2 = this.tvIndex;
                textView2.setText((i + 1) + "  of  " + this.allDownLoadList.size());
            } else {
                this.tvIndex.setText("");
            }
        } else {
            showDialog(str2, z);
        }
        ((CollectionPresent) this.presenter).getDownLoading(str, str3, str2, z, i, new DownLoadListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.25
            @Override // com.gisocn.onemap.interfaces.DownLoadListener
            public void onFailure() {
            }

            @Override // com.gisocn.onemap.interfaces.DownLoadListener
            public void onStart() {
            }

            @Override // com.gisocn.onemap.interfaces.DownLoadListener
            public void onProgress(int i2) {
                Message message = new Message();
                message.what = 2;
                message.arg1 = i2;
                message.arg2 = !z ? 1 : 0;
                CollectionFragment.this.handler.sendMessage(message);
            }

            @Override // com.gisocn.onemap.interfaces.DownLoadListener
            public void onFinish(String str4) {
                L.e("localPath" + str4);
            }
        });
    }

    boolean isLocalExist(String str) {
        return this.filesLocaList.contains(str);
    }

    public void showDialog(String str, boolean z) {
        LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(getActivity()).inflate(R.layout.dialog_download_progress, (ViewGroup) null);
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setView(linearLayout).setCancelable(false);
        AlertDialog create = builder.create();
        this.dialog = create;
        create.show();
        this.tvIndex = (TextView) linearLayout.findViewById(R.id.tv_index);
        TextView textView = (TextView) linearLayout.findViewById(R.id.tv_file_name);
        this.tvFileName = textView;
        textView.setText("正在下载\"" + str + Typography.quote);
        if (z) {
            TextView textView2 = this.tvIndex;
            textView2.setText((this.fileIndex + 1) + "  of  " + this.allDownLoadList.size());
        }
        this.tvOff = (TextView) linearLayout.findViewById(R.id.tv_off);
        this.numberProgressBar = (NumberProgressBar) linearLayout.findViewById(R.id.number_progress_bar);
        this.tvOff.setText("取消");
        this.tvOff.setOnClickListener(new View.OnClickListener() { // from class: com.gisocn.onemap.ui.fragment.CollectionFragment.26
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                CollectionFragment.this.dialog.dismiss();
            }
        });
    }

    @Override // androidx.fragment.app.Fragment
    public void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }
}
